home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir26 / epi601_2.zip / FILES07.EXE / SSAMPLE.PGM < prev    next >
Text File  |  1994-08-22  |  2KB  |  51 lines

  1. *SSAMPLE.PGM is a program to take a systematic sample of
  2. *records in a file with a randomly selected starting point.  If you
  3. *want to take a 1/5 sample of 75 records, for example, the sample
  4. *will pick a random number from 1 to 15, and start at that record, taking
  5. *every fifth record thereafter.  Unlike RSAMPLE.PGM, the size of the
  6. *systematic sample is predictable.
  7.  
  8. READ ?   Name of .REC file to sample: ?
  9. DEFINE DENOM #### GLOBAL
  10. DEFINE START #### GLOBAL
  11. DEFINE REMAINDER ########
  12. CLS
  13. ECHO
  14. ECHO
  15. ECHO This program takes a systematic sample of records in a file,
  16. ECHO starting at a random location.
  17. ECHO
  18. ECHO Please specify a denominator for the sampling fraction.
  19. ECHO To select 1 record out of 20 (a 5% sample), for example,
  20. ECHO you should enter 20 as the denominator...
  21. ECHO
  22. ECHO
  23. ECHO    Denominator of sampling fraction:
  24. IMMEDIATE DENOM = ?    Must be an integer (e.g., 5,10,20) ?
  25. ECHO
  26. ECHO
  27.  
  28.  
  29. *Select starting point
  30. IMMEDIATE START = RAN (DENOM)
  31. TYPE "Taking one record of every @DENOM starting at record @START"
  32. ? Press a key to continue ?
  33. *Implement a MOD function
  34. *If START +RECNUMBER is divisible by DENOM without any remainder,
  35. *then select the record
  36. REMAINDER = ((START + RECNUMBER) / DENOM) - ((START + RECNUMBER) DIV DENOM)
  37. SELECT REMAINDER = 0
  38. *Open output file
  39. ERASE SSAMPLE.REC
  40. ROUTE SSAMPLE.REC
  41. WRITE RECFILE NOT DENOM START REMAINDER
  42. *View results
  43. READ SSAMPLE.REC
  44. LIST
  45. TYPE "  The records above are contained in file SSAMPLE.REC."
  46. TYPE "  If you wish to save the sample, please rename or copy "
  47. TYPE "  SSAMPLE.REC before running SSAMPLE.PGM again."
  48. ? Press any key to QUIT ?
  49. QUIT
  50.  
  51.